use "${clean}analysis.dta", clear
keep if year < 1900

gen period = year > 1860



cap drop partysection
gen partysection = .
replace partysection = 1 if partyid == 1 & north == 1 // northern whigs or republicans
replace partysection = 2 if partyid == 0 & north == 1 // northern democrats
replace partysection = 3 if partyid == 1 & south == 1 // southern whigs or republicans
replace partysection = 4 if partyid == 0 & south == 1 // southern democrats
label define partysectionlab 1 "N. Whig/Rep." 2 "N. Dem." 3 "S. Whig/Rep." 4 "S. Dem.", modify
label values partysection partysectionlab

//standardizing variables
egen birth_county_surban = std(birth_county_urban_percent)
egen birth_county_srugged = std(birth_county_ruggedness)
egen birth_county_spostoffice = std(birth_county_postoffice_area)
egen sborn = std(born)


// creating a variable to keep the sample constant
cap drop sample
gen sample = 1
foreach var of varlist $county_bcontrols $life_controls partysection {
	replace sample = . if `var' == .
}
keep if sample == 1


// looking at southern Repubicans
preserve

keep if south == 1
keep if partyid == 1
replace period = 2 if congress > 44

tab period singular, row chi2

restore



// looking at northerners in the same period
preserve
keep if north == 1
keep if year >= 1866 & year <= 1876

su singular year
restore

